package net.sk.china.city.mapper;

import java.math.BigDecimal;
import java.util.List;
import net.sk.china.city.domain.ArExchange;
import net.sk.china.city.domain.vo.ArExchangeVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

/**
 * 兑换记录Mapper接口
 * 
 * @author gxf
 * @date 2024-04-12
 */
public interface ArExchangeMapper extends BaseMapper<ArExchange>
{
    /**
     * 查询兑换记录
     * 
     * @param id 兑换记录主键
     * @return 兑换记录
     */
    public ArExchangeVO selectArExchangeById(Long id);

    /**
     * 查询兑换记录列表
     * 传更新时间会获取该更新时间之后的数据
     * @return 兑换记录集合
     */
    public List<ArExchangeVO> selectArExchangeList(ArExchangeVO arExchangeVo);

    /**
     * 新增兑换记录
     * 
     * @param arExchange 兑换记录
     * @return 结果
     */
    public int insertArExchange(ArExchange arExchange);

    /**
     * 修改兑换记录
     * 
     * @param arExchange 兑换记录
     * @return 结果
     */
    public int updateArExchange(ArExchange arExchange);

    /**
     * 删除兑换记录
     * 
     * @param id 兑换记录主键
     * @return 结果
     */
    public int deleteArExchangeById(Long id);

    /**
     * 批量删除兑换记录
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteArExchangeByIds(Long[] ids);

    //社区积分兑换数
    Long selectTotalExchange(Long gridId);

    List<ArExchangeVO> getLastExchange();

    @Select("select sum(total_price) from ar_exchange")
    BigDecimal selectExchangeTotalValue();
}
